<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>魏远商城</title>
		<meta name="viewport" content="initial-scale=1, maximum-scale=1">
		<link rel="shortcut icon" href="/favicon.ico">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="css/sm.css">
		<link rel="stylesheet" href="css/sm-extend.css">
		<link rel="stylesheet" href="css/ionicons.css">
		<link rel="stylesheet" href="css/my-order.css">
		<link rel="stylesheet" type="text/css" href="css/refund.css"/>
		<style type="text/css">
			.icon-shuaxin1:before {
			    content: "";
			}
			.bar-nav{
				border-bottom: 1px solid #e7e7e7;
			}
			</style>
	</head>

	<body>
		<div class="page-group content">
			<header class="bar bar-nav">
				<span class="order-back mui-action-back"><img src="img/back-le.png" height="50%"/></span>
				<a class="button button-link iconfont icon-shuaxin1 pull-right"></a>
				<h1 class="title">申请退货</h1>
			</header>
			<div style="margin-top: 55px;padding: 0px 5%;">
				<!--<div class="top">
					<p><span class="tuitype">退货类型</span><span class="xing">*</span></p>
					<span class="top1 topc">我要退款(无需退货)</span>
					<span class="top2 topc">我要退货</span>
				</div>-->
				<div id="result" class="top">
					<p><span class="tuirea">退货原因</span><span class="xing">*</span></p>
					<span id="result2">请选择退货原因</span>
				</div>
				<!--<div class="top backmoney">
					<p><span class="tuimoney">退货金额</span><span class="xing">*</span><span class="money">最多13.91</span></p>
					<input class="backinput" type="text" placeholder="请输入退款金额" name="" id="" value="" />
				</div>-->
				<div class="top tuisd">
					<p><span class="tuishuo">退货说明</span><span class="xing">*</span><span class="money">(可不填)</span></p>
					<textarea name="" class="backshuod" placeholder="请输入退款说明" rows="" cols=""></textarea>
					<!--<input type="text" placeholder="请输入退款说明" name="" id="" value="" />-->
				</div>
				<div class="buttom">
					<div class="buttom_goto">提交申请</div>
				</div>
				<div id="tanchu"></div>
				<div id="tanchu1">
					<p class="tanchu2"><span>假冒品牌</span><span id="yuan"></span></p>
					<p class="tanchu2"><span>卖家发错货</span><span id="yuan"></span></p>
					<p class="tanchu2"><span>效果不太好</span><span id="yuan"></span></p>
					<p class="tanchu2"><span>收到商品破损</span><span id="yuan"></span></p>
					<p class="tanchu2"><span>其他</span><span id="yuan"></span></p>
				</div>
			</div>
		</div>
		<script src="js/jquery-3.1.1.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/mui.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/url.js"></script>
		<script type="text/javascript">
			$('#result').on('tap',function(){
				$('#tanchu').css('height',$(document).height());
				$('#tanchu').css('display','block')
				$('#tanchu1').css('display','block')
			})
			$('#tanchu').on('tap',function(){
				$('#tanchu').css('display','none')
				$('#tanchu1').css('display','none')
			})
			$('.tanchu2').on('tap',function(){
//				$('#yuan').css('border-color','red')
				$('#tanchu').css('display','none')
				$('#tanchu1').css('display','none')
				$('#result2').text($(this).text())
			})
			
//			$('.topc').on('tap',function(){
//				$(this).addClass('avticesel');
//				$(this).siblings().removeClass('avticesel');
//				 if($('.top1').hasClass('avticesel')){
//				 	$('.tuirea').text('退款原因');
//				 	$('.tuimoney').text('退款金额');
//				 	$('.tuishuo').text('退款说明');
//				 	$('#result2').text('请选择退款原因');
////				   	     alert(1);
////				   	     backmoney();
//				   	     $('.backmoney').css('display','block');
//				   	     $('.tuisd').css('display','none');
//				       }else if($('.top2').hasClass('avticesel')){
////				   	     alert(2);
////				   	     backgoods()
//	                    $('.tuirea').text('退货原因');
//					 	$('.tuimoney').text('退货金额');
//					 	$('.tuishuo').text('退货说明');
//					 	$('#result2').text('请选择退货原因');
//				   	    $('.backmoney').css('display','none');
//				   	    $('.tuisd').css('display','block');
//				   	   }
//			})
			
			
			$('.buttom_goto').on('tap',function(){
				    backgoods();
				})
//				   alert(345);
//				   
//				   if($('.top1').hasClass('avticesel')||$('.top2').hasClass('avticesel')){
//				   	   if($('.top1').hasClass('avticesel')){
//				   	     alert(1);
//				   	     backmoney();
//				       }else if($('.top2').hasClass('avticesel')){
//				   	     alert(2);
//				   	     backgoods()
//				   	   }
//				   }else if(!$('.top1').hasClass('avticesel')&&!$('.top2').hasClass('avticesel')){
//				   	   mui.toast('请选择退款类型');
//				      alert(9999);
//				   }
//				backmoney();
//			
			
//			function backmoney(){  
//				if($('#result2').text()=='请选择退款原因'){
//					mui.toast('请选择退款原因');
//				}else if($('.backinput').val()==''){
//					mui.toast('退款金额不能为空');
//				}else{
//			$.ajax({
//				type:"post",
//				url:ur+"/mobilemember/frontOrderOperation/refundAmount",
//				ddataType:'json',
//				headers: {
//						'X-Token': localStorage.token,
//					},
//				data: {
//						'orderVO.id': localStorage.status,
//						'remark':$('#result2').text()
//					},
//				success:function(data){
////					if(){
////						
////					}
//					console.log(data);
//				},
//				error:function(data){
//					console.log(data);
//				}
//			});
//			}
//			}
			
			
			function backgoods(){
				 if($('#result2').text()=='请选择退货原因'){
					mui.toast('请选择退货原因');
				}else if($('.backshuod').val()==''){
					mui.toast('退款金额不能为空');
				}else{
			$.ajax({
				type:"post",
				url:ur+"/mobilemember/frontOrderOperation/returnReplacement",
				ddataType:'json',
				headers: {
						'X-Token': localStorage.token,
					},
				data: {
						'OrderVO.id': localStorage.deorderid,
						'refundGoodsproductVO.amount':localStorage.backhow,
						'refundGoodsproductVO.productSkuId':localStorage.reskuid,
						'remark':$('#result2').text(),
						'type':13
							//								'status':status
					},
				success:function(data){
					if(data.result.meta.code==200){
						mui.toast('申请退货成功');
//						var order = plus.webview.getWebviewById('my-order');
//	                        mui.fire(order,'uporder');
	                         mui.back();
					}else if(data.result.meta.code==202){
						mui.toast('该订单不可申请退货');
					}
					console.log(data);
				},
				error:function(data){
					console.log(data);
				}
			});
			}
		}
		</script>
	</body>
</html>